<template>
  <!-- 订单支付 -->
  <el-dialog :title="$t('message.ddzf')" :visible.sync="dialogTableVisible" :close-on-click-modal="modalDialog" :close-on-press-escape="modalDialog" top="15vh !important" :before-close="cancelOrder" width="1000px" append-to-body>
    <div class="orderBox">
      <div class="orderLeft">
        <div class="orderPriceBt">
          {{ $t("message.ddje") }}：{{ orderMessgae.allPrice }}
        </div>
        <div v-if="type != 'bracelet'" class="gjCnt">
          {{ $t("message.xfje") }}：
          <!-- <el-input
            v-if="modPrice"
            v-model="modPValue"
            maxlength="10"
            clearable
            oninput="value=value.replace(/[^0-9]{0,1}(\d*(?:\.\d{0,2})?).*$/g, '$1');"
            :placeholder="$t('message.qsrnewprice')"
          /> -->
          <el-input-number v-if="modPrice" v-model="modPValue" style="width: 140px" maxlength="10" clearable :placeholder="$t('message.qsrnewprice')" :precision="2" :step="0.1" :min="0" @change="gjChange" />
          <el-input v-if="!modPrice" v-model="orderMessgae.allPrice" disabled />
          {{ $t("message.yuan") }}
          <el-checkbox v-if="
              payType != 10 &&
                canMod &&
                type != 'defaultReserve' &&
                type != 'vipRecharge' &&
                type != 'vipAdd' &&
                type != 'lease' &&
                type != 'leaseList'
            " v-model="modPrice" style="margin-left: 10px">{{ $t("message.ddgj") }}</el-checkbox>
        </div>
        <template v-if="type == 'specialCardBuy'">
          <el-table :data="orderMessgae.specialCardOrderInfo" border fit max-height="230" :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column align="center" :label="$t('message.sp')" prop="name" min-width="120" show-overflow-tooltip />
            <el-table-column align="center" :label="$t('message.dprice')" prop="partPrice" min-width="70" show-overflow-tooltip />
            <el-table-column align="center" :label="$t('message.num')" prop="num" min-width="60" show-overflow-tooltip />
          </el-table>
        </template>
        <template v-if="
            (type == 'goodsSale' ||
              type == 'goods' ||
              type == 'table' ||
              type == 'financeDefaultSpend' ||
              type == 'handlingFees' ||
              type == 'dinnerOnline'||
              type == 'dinner') &&
              orderMessgae.goodsInfos &&
              orderMessgae.goodsInfos.length > 0
          ">
          <el-table :data="orderMessgae.goodsInfos" border fit max-height="230" :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.ddxx')" show-overflow-tooltip>
              >
              <template slot-scope="scope">
                {{ type == "handlingFees" ? scope.row.name : scope.row
                }}{{
                  type == "handlingFees"
                    ? scope.row.partPrice + $t("message.yuan")
                    : ""
                }}
              </template></el-table-column>
          </el-table>
        </template>
        <template v-if="
            type == 'assemblyField' &&
              orderMessgae.detail &&
              orderMessgae.detail.length > 0
          ">
          <el-table :data="orderMessgae.detail" border fit max-height="230" :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column align="center" :label="$t('message.yqhpq')" prop="name" min-width="120" show-overflow-tooltip />
            <el-table-column align="center" :label="$t('message.hdxm')" prop="projectName" min-width="100" show-overflow-tooltip />
            <el-table-column align="center" :label="$t('message.bmfy')" prop="price" min-width="100" show-overflow-tooltip />
            <el-table-column align="center" :label="$t('message.hdsj')" min-width="190" prop="acTime" show-overflow-tooltip />
          </el-table>
        </template>
        <template v-if="
            (type == 'goodsSale' ||
              type == 'goods' ||
              type == 'table' ||
              type == 'financeDefaultSpend' ||
              type == 'dinnerOnline'||
              type == 'dinner') &&
              (!orderMessgae.goodsInfos || orderMessgae.goodsInfos.length == 0)
          ">
          <el-table :data="[orderMessgae.goodsInfo]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.ddxx')" show-overflow-tooltip>
              >
              <template slot-scope="scope">
                {{ scope.row }}
              </template></el-table-column>
          </el-table>
        </template>
        <template v-if="type == 'areaSellOrder' || type == 'defaultReserve'">
          <el-table :data="orderMessgae.siteList" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.cdname')" show-overflow-tooltip prop="siteModelName" align="center" />
            <el-table-column :label="$t('message.time')" show-overflow-tooltip align="center">
              <template slot-scope="scope">
                {{ scope.row.beginTime + " - " + scope.row.endTime }}
              </template></el-table-column>
            <el-table-column :label="$t('message.feiyon')" show-overflow-tooltip prop="price" width="80" align="center">
              <template slot-scope="scope">
                {{ scope.row.price || 0 }} {{ $t("message.yuan") }}
              </template></el-table-column>
          </el-table>
        </template>
        <template v-if="type == 'escort'">
          <el-table :data="[orderMessgae]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.sp')" show-overflow-tooltip prop="escortName" align="center" />
            <el-table-column :label="$t('message.dprice')" show-overflow-tooltip align="center" prop="price" />
            <el-table-column :label="$t('message.num')" show-overflow-tooltip width="80" align="center">
              <template slot-scope="scope">1</template>
            </el-table-column>
          </el-table>
        </template>
        <template v-if="type == 'studentPay'">
          <el-table :data="[orderMessgae]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.kcmc')" show-overflow-tooltip prop="courseName" align="center" />
            <el-table-column :label="$t('message.xueyuan')" show-overflow-tooltip width="80" align="center" prop="student" />
          </el-table>
        </template>
        <template v-if="type == 'bracelet'">
          <el-table :data="orderMessgae.goodsInfo" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.shouhuan')" show-overflow-tooltip prop="braceletId" align="center" />
            <el-table-column :label="$t('message.yj')" show-overflow-tooltip align="center" prop="price" width="80" />
            <el-table-column :label="$t('message.num')" show-overflow-tooltip prop="num" width="80" align="center" />
          </el-table>
        </template>
        <template v-if="type == 'comboOrder' || type == 'combo'">
          <el-table :data="orderMessgae.mealsPaysResponseParamList" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column v-if="
                orderMessgae.mealsPaysResponseParamList[0].mealsType != '3' &&
                  orderMessgae.mealsPaysResponseParamList[0].mealsType != '4'
              " :label="$t('message.xmmc')" show-overflow-tooltip prop="projectNmae" align="center">
              <template slot-scope="scope">
                <span v-if="
                    scope.row.mealsType != '3' && scope.row.mealsType != '4'
                  ">{{ scope.row.projectNmae }}</span>
              </template>
            </el-table-column>
            <el-table-column :label="$t('message.tc')" show-overflow-tooltip prop="name" align="center" />
            <el-table-column :label="$t('message.price')" show-overflow-tooltip prop="price" align="center" width="80">
              <template slot-scope="scope">
                {{ scope.row.price || 0 }}{{ $t("message.yuan") }}
              </template></el-table-column>
            <el-table-column :label="$t('message.num')" show-overflow-tooltip prop="mealsNum" align="center" width="80" />
          </el-table>
        </template>
        <template v-if="type == 'lease' || type == 'leaseList'">
          <el-table :data="orderMessgae.equipmentConfirmRespParamList" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.qcmc')" show-overflow-tooltip prop="name" align="center" min-width="90" />
            <el-table-column :label="$t('message.yj')" show-overflow-tooltip prop="deposit" align="center" min-width="70" />
            <el-table-column :label="$t('message.sfbz')" show-overflow-tooltip prop="chargeInfo" align="center" min-width="120" />
            <el-table-column :label="$t('message.mfsjfz')" show-overflow-tooltip prop="freeTime" align="center" min-width="110">
              <template slot-scope="scope">
                {{ scope.row.freeTime || 0 }}
              </template></el-table-column>
          </el-table>
        </template>
        <template v-if="type == 'ticket' || type == 'ticketOrder'">
          <el-table :data="orderMessgae.ticketPaysResponseParamList" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.xmmc')" show-overflow-tooltip prop="projectNmae" align="center" />
            <el-table-column :label="$t('message.mp')" show-overflow-tooltip prop="name" align="center" />
            <el-table-column :label="$t('message.price')" show-overflow-tooltip prop="price" align="center" width="80">
              <template slot-scope="scope">
                {{ scope.row.price || 0 }}{{ $t("message.yuan") }}
              </template></el-table-column>
            <el-table-column :label="$t('message.num')" show-overflow-tooltip prop="num" align="center" width="80" />
            <el-table-column :label="$t('message.oldprice')" show-overflow-tooltip prop="price" align="center" width="80">
              <template slot-scope="scope">
                {{ scope.row.deposit || 0 }}
              </template></el-table-column>
          </el-table>
        </template>
        <template v-if="type == 'vipRecharge'">
          <el-table :data="[orderMessgae]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.memberInfo')" show-overflow-tooltip prop="nickName" align="center" />
            <el-table-column :label="$t('message.hydj')" show-overflow-tooltip prop="cardName" align="center" />
            <el-table-column :label="$t('message.czje')" show-overflow-tooltip align="center" width="80">
              <template slot-scope="scope">
                {{ scope.row.originalPrice || orderMessgae.allPrice
                }}{{ $t("message.yuan") }}
              </template></el-table-column>
            <el-table-column :label="$t('message.zsje')" show-overflow-tooltip align="center" width="80">
              <template slot-scope="scope">
                {{ scope.row.giveMoney || 0 }}{{ $t("message.yuan") }}
              </template></el-table-column>
          </el-table>
        </template>
        <template v-if="type == 'studentAdd'">
          <el-table :data="[orderMessgae]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.kcxx')" show-overflow-tooltip prop="courseName" align="center" min-width="100" />
            <el-table-column :label="$t('message.skjl')" show-overflow-tooltip prop="teacherName" align="center" width="80" />
            <el-table-column v-if="orderMessgae.beginDate" :label="$t('message.kcsj')" show-overflow-tooltip align="center" width="120" prop="beginDate" />
            <el-table-column :label="$t('message.kcjg')" show-overflow-tooltip align="center" width="80" prop="allPrice" />
            <el-table-column :label="$t('message.kclx')" show-overflow-tooltip align="center" width="80">
              <template slot-scope="scope">
                {{
                  scope.row.courseType == 1
                    ? $t("message.ttk")
                    : scope.row.courseType == 2 || scope.row.courseType == 4
                      ? $t("message.sjk")
                      : $t("message.cgk")
                }}
              </template></el-table-column>
            <el-table-column :label="$t('message.xyxm')" show-overflow-tooltip align="center" width="80" prop="student" />
          </el-table>
        </template>
        <template v-if="type == 'vipAdd'">
          <el-table :data="[orderMessgae]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.hykgm')" show-overflow-tooltip prop="cardName" align="center" />
            <el-table-column :label="$t('message.cardnum')" show-overflow-tooltip prop="number" align="center" />
          </el-table>
        </template>
        <template v-if="type == 'groupOpen'">
          <el-table :data="[orderMessgae]" max-height="230" border fit :header-row-class-name="'table-header'" class="doumee-element-table">
            <el-table-column :label="$t('message.ddxx')" show-overflow-tooltip prop="orderInfo" />
          </el-table>
        </template>
      </div>
      <div class="orderRight">
        <el-form ref="form" @submit.native.prevent>
          <el-input v-if="
              (hyxz && payType === '01') ||
                (hyxz &&
                  (payType === '10' ||
                    payType === '04' ||
                    payType === '02' ||
                    payType === '05' ||
                    payType === '08' ||
                    payType === '07') &&
                  fyms === '0')
            " v-model="cardNum" :placeholder="$t('message.qsr') + $t('message.hy1')" style="width: 100%; margin-bottom: 10px" clearable @keyup.enter.native="searchAction">
            <el-button slot="append" icon="el-icon-search" @click="searchAction" />
          </el-input>
          <div v-if="showMessage && cardMessage.nickName" class="memberDetail">
            <img src="@/icons/png/default_pic.png" width="40px" height="40px">
            <div class="memberRight">
              <div>
                {{ cardMessage.nickName }}
              </div>
              <div>
                {{ $t("message.zhye") }}：<span class="money">{{ cardMessage.remainingMoney || 0 }} /
                  {{ cardMessage.remainingGiveMoney || 0 }}</span>
              </div>
              <div>
                {{ $t("message.hydj") }}：<span>{{
                  cardMessage.cardName
                }}</span>
              </div>
            </div>
          </div>
          <div class="zffsBt">{{ $t("message.zffs") }}：</div>
          <template v-for="(item, index) in payTypes">
            <el-button v-if="
                !(
                  (orderMessgae.userType == 1 &&
                    item.value == '01' &&
                    (type == 'areaSellOrder' || type == 'assemblyField')) ||
                  !item.show
                )
              " :key="index" v-preventReClick class="pay-style" :class="
                payTypes[index].value == payType
                  ? 'slelect-pay-style'
                  : 'normal-pay-style'
              " type="text" @click="changePayType(item)">{{ item.name }}</el-button>
          </template>
          <div v-if="payType === '14'" class="zffsBt mt10" style="
              display: flex;
              align-items: center;
              justify-content: space-between;
            ">
            {{ $t("message.hykzf") }}：<span class="red" style="font-size: 14px; font-weight: bolder">{{ cardPayPrice }}</span>
          </div>
          <div v-if="payType === '14'" class="zffsBt mt10" style="
              display: flex;
              align-items: center;
              justify-content: space-between;
            ">
            {{ $t("message.syxzf") }}：
            <span class="red" style="font-size: 14px; font-weight: bolder">{{
              modPrice && modPValue > 0
                ? (Number(modPValue) - Number(cardPayPrice)).toFixed(2)
                : (Number(lastPrice.price) - Number(cardPayPrice)).toFixed(2)
            }}</span>
          </div>
          <div v-if="payType === '14'" class="zffsBt mt10" style="
              display: flex;
              align-items: center;
              justify-content: space-between;
            ">
            <el-select v-model="payTypeb" :placeholder="$t('message.qszhhffs')" style="width: 220px; margin-right: 10px" @change="changePayTypeb">
              <el-option v-for="(item, index) in payTypebs" :key="index" :label="item.name" :value="item.value">{{ item.name }}</el-option>
            </el-select>
            <el-input v-if="payTypeb === '10'" v-model="mtTgh" clearable maxlength="50" :placeholder="$t('message.sr') + $t('message.mttgh')" style="flex: 1" />
            <el-input v-if="payTypeb === '04'" v-model="authCode" v-focus :placeholder="$t('message.qsrsmzfb')" clearable style="flex: 1" />
            <el-input v-if="payTypeb === '05'" v-model="authCode" v-focus :placeholder="$t('message.qsrsmwx')" clearable style="flex: 1" />
            <el-input v-if="payTypeb === '08'" v-model="authCode" v-focus :placeholder="$t('message.qsrsm')" clearable style="flex: 1" />
            <div v-if="payTypeb === '02'" class="sjfk" style="
                flex: 1;
                display: flex;
                align-items: center;
                justify-content: space-between;
              ">
              <el-input-number v-model="payMoney" style="width: 140px; margin: 0 4px" maxlength="10" size="large" clearable :placeholder="$t('message.qsr') + $t('message.sfje')" :precision="2" :step="0.1" :min="0" @input="payByMoneyb" />
              <span style="font-size: 14px">{{ $t("message.zl") }}：<b class="red">{{
                changeMoney.toFixed(2)
              }}</b></span>
            </div>
          </div>

          <el-select v-if="payType === '13'" v-model="msCardId" :placeholder="$t('message.qxz') + $t('message.zxk')" style="width: 100%" class="mb20" clearable @change="getOrderPrice">
            <el-option v-for="item in specialList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-select v-if="payType === '01' && mealsList.length > 0" v-model="mealsMemberId" :placeholder="$t('message.qxz') + $t('message.ydck')" style="width: 100%" clearable @change="getOrderPrice">
            <el-option v-for="item in mealsList" :key="item.id" :label="item.label" :value="item.id" />
          </el-select>
          <div style="
              display: flex;
              align-items: center;
              height: 40px;
              margin-bottom: 10px;
            ">
            <span>{{ $t("message.yfdj") }}：</span>
            <el-select v-model="yfdjId" :placeholder="$t('message.qxz') + $t('message.yfdj')" style="width: 150px" clearable @change="getOrderPrice(1)">
              <el-option v-for="item in yfdjList" :key="item.id" :label="$t('message.rmbfh')+item.allPrice" :value="item.id" />
            </el-select>
            <el-button type="primary" class="ml10" @click="replacementBtn">{{
              $t("message.hygg")
            }}</el-button>
          </div>
          <el-form-item v-if="payType === '10'" :label="$t('message.mttgh')" label-width="auto">
            <el-input v-model="mtTgh" clearable maxlength="50" :placeholder="$t('message.sr') + $t('message.mttgh')" />
          </el-form-item>
          <el-form-item v-else-if="payType === '04'" :label="$t('message.fkm')" label-width="auto">
            <el-input v-model="authCode" v-focus :placeholder="$t('message.qsrsmzfb')" clearable />
          </el-form-item>
          <el-form-item v-else-if="payType === '05'" :label="$t('message.fkm')" label-width="auto">
            <el-input v-model="authCode" v-focus :placeholder="$t('message.qsrsmwx')" clearable />
          </el-form-item>
          <el-form-item v-else-if="payType === '08'" :label="$t('message.fkm')" label-width="auto">
            <el-input v-model="authCode" v-focus :placeholder="$t('message.qsrsm')" clearable />
          </el-form-item>
          <div v-if="
              lastPrice.policyId && lastPrice.policyName && payType !== '14'
            " class="yhzc">
            {{ $t("message.yhzc") }}：<span>{{ lastPrice.policyName }}</span>
          </div>
          <el-form-item v-if="
              payType === '01' &&
                lastPrice.useIntegral &&
                payType !== '14' &&
                lastPrice.useAmot &&
                !changePrice
            " :label="$t('message.jfdk')" label-width="auto" style="margin-bottom: 10px;">
            <el-switch v-model="integralUse" :active-value="'1'" :inactive-value="'0'" :active-text="
                $t('message.shiyon') +
                  lastPrice.useIntegral +
                  $t('message.jfdk') +
                  lastPrice.useAmot +
                  $t('message.yuan')
              " />
          </el-form-item>
          <el-form-item v-if="
              payType === '13' &&
                lastPrice.useIntegral &&
                payType !== '14' &&
                lastPrice.useAmot &&
                !changePrice
            " :label="$t('message.jfdk')" label-width="auto" style="margin-bottom: 10px;">
            <el-switch v-model="integralUse" :active-value="'1'" :inactive-value="'0'" :active-text="
                $t('message.shiyon') +
                  lastPrice.useIntegral +
                  $t('message.jfdk') +
                  lastPrice.useAmot +
                  $t('message.yuan')
              " />
          </el-form-item>
          <el-form-item v-if="payType === '01' || (payType === '14' && payTypeb === '01')" :label="$t('message.zsje')" label-width="auto">
            <el-switch v-model="giveMoney" :active-value="true" :inactive-value="false" :active-text="$t('message.yxkczsje')" />
          </el-form-item>
          <el-form-item v-if="payType === '03' || (payType === '14' && payTypeb === '03')" :label="$t('message.kksx')" label-width="auto">
            <el-switch v-model="giveMoney" :active-value="true" :inactive-value="false" :active-text="$t('message.yxkczsje')" />
          </el-form-item>
          <el-form-item>
            <el-input v-model="remark" :placeholder="$t('message.qsr') + $t('message.bzxx')" clearable />
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="footCnt">
      <div v-if="hasLastPrice" class="bottom-left">
        {{ $t("message.yfje") }}：
        <span class="ysje">{{ $t('message.rmbfh') }}{{
          modPrice
            ? modPValue || 0
            : integralUse == "0"
              ? lastPrice.price
              : (Number(lastPrice.price) - Number(lastPrice.useAmot)).toFixed(2)
        }}</span>
        <template v-if="
            !modPrice &&
              ((integralUse == '0' &&
                lastPrice.originalPrice - lastPrice.price > 0) ||
                (integralUse == '1' &&
                  lastPrice.originalPrice -
                  (lastPrice.price - lastPrice.useAmot) >
                  0))
          ">
          {{ $t("message.yhje") }}：
          <span class="discoun-style">{{
            modPrice
              ? 0
              : integralUse == "1"
                ? (
                  lastPrice.originalPrice -
                  (lastPrice.price - lastPrice.useAmot)
                ).toFixed(2)
                : (lastPrice.originalPrice - lastPrice.price).toFixed(2)
          }}</span>
          <span class="dis-title-style">{{ $t("message.yuan") }}</span>
        </template>
      </div>
      <div class="bottom-right">
        <div v-if="payType === '02'" class="sjfk">
          {{ $t("message.sfxj") }}：
          <el-input-number v-model="payMoney" style="width: 140px; margin: 0 4px" maxlength="10" clearable :placeholder="$t('message.qsrje')" :precision="2" :step="0.1" :min="0" @input="payByMoney" />
          {{ $t("message.zl") }}：
          <b>{{ changeMoney.toFixed(2) }}</b>
        </div>
        <div v-if="
            (payType === '01' && lastPrice.isRequired === '1') ||
              (payType === '14' && lastPrice.isRequired === '1')
          " class="sjfk">
          {{ $t("message.zfmm") }}：
          <el-input v-model="cardPwd" type="password" style="width: 150px" :placeholder="$t('message.qsr') + $t('message.zfmm')" maxlength="6" clearable oninput="value=value.replace(/[^\d]/g,'')" />
        </div>
        <el-button type="primary" :loading="payLoading" style="margin-left: 20px" @click="payOrder">{{ $t("message.jiezhan") }}</el-button>
      </div>
    </div>
    <el-dialog :title="$t('message.smzf')" :visible.sync="showSm" :close-on-click-modal="modalDialog" :close-on-press-escape="modalDialog" :append-to-body="true" top="20vh !important" width="500px">
      <div class="smtip">{{ $t("message.qsmkhskm") }}</div>
      <img src="@/icons/png/ic_saomiao.png" width="200px" height="200px" class="smImg">
      <div class="smFoot">
        <el-input ref="code" v-model="smCode" v-focus :placeholder="$t('message.qsmkhskm')" clearable @keyup.enter.native="smQrbtn" />
        <el-button type="primary" style="margin-left: 20px" @click="smQrbtn">{{
          $t("message.qr")
        }}</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="$t('message.hygg')" :visible.sync="showReplacement" :close-on-click-modal="modalDialog" :close-on-press-escape="modalDialog" :append-to-body="true" top="20vh !important" width="500px">
      <div v-if="replacement.id" style="height: 40px; display: flex; align-items: center">
        {{ $t("message.dqhy") }}：{{ replacement.nickName }}
        {{ replacement.jobNo ? "+" + replacement.jobNo : "" }}
      </div>
      <div v-else style="height: 40px; display: flex; align-items: center">
        {{ $t("message.dqhy") }}：{{ cardMessage.nickName }}
        {{ cardMessage.jobNo ? "+" + cardMessage.jobNo : "" }}
      </div>
      <div v-if="showReplacement" style="width: 100%">
        <MemberSearch ref="memberSearchRef" @clear="tgMemberClear" @select="tgMemberSelect" />
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closewReplacement">{{ $t("message.qx") }}</el-button>
        <el-button v-preventReClick type="primary" @click="confirmReplacement">{{ $t("message.qr") }}</el-button>
      </div>
    </el-dialog>
    <PrintTem v-if="isPrint1" ref="printTemRef" />
    <ComboTem v-if="isPrint2" ref="ComboTemRef" />
    <CourseTem v-if="isPrint3" ref="CourseTemRef" />
    <RechargeTem v-if="isPrint4" ref="RechargeTemRef" />
    <BykTem v-if="isPrint5" ref="BykTemRef" />
    <GoodsTem v-if="isPrint6" ref="GoodsTemRef" />
    <RefundTem v-if="isPrint7" ref="RefundTemRef" />
    <PrintTable ref="PrintTableRef" @cancelDialog="cancelDialog" @printd="printd" />
  </el-dialog>
</template>

<script>
import { printOrder, courseGoOnPay, escortPayInfo, ableOrienteerByOrder, equipmentLeaseContinuePay, configList, equipmentLeaseConfirm, getOneByOrderAndMember, getPrice, scanCodePay, orderType, payForOrder, VIPInfo, goodsOrderContinuePay, goodsPayForVenue, memberInfo, mealPayInfo, ticketPayAgain, payInfo, siteOrderInfo, mealsReserveCard, enrolCoursePc } from '@/api'
import { mealInfo } from '@/api/combo'
import MemberSearch from '@/components/MemberSearch'
import PrintTem from '@/components/printTem'
import ComboTem from '@/components/printTem/combo.vue'
import RechargeTem from '@/components/printTem/recharge.vue'
import CourseTem from '@/components/printTem/course.vue'
import BykTem from '@/components/printTem/banyouka.vue'
import GoodsTem from '@/components/printTem/goods.vue'
import RefundTem from '@/components/printTem/refund.vue'
import PrintTable from '@/components/printTable.vue'
import store from '@/store'
export default {
  components: {
    MemberSearch,
    PrintTem,
    ComboTem,
    RechargeTem,
    RefundTem,
    GoodsTem,
    CourseTem,
    BykTem,
    PrintTable
  },
  data () {
    return {
      modalDialog: store.getters.dialog,
      payLoading: false,
      showSm: false,
      cardPayPrice: 0,
      isPrint1: false,
      isPrint2: false,
      isPrint3: false,
      isPrint4: false,
      isPrint5: false,
      isPrint6: false,
      isPrint7: false,
      payMoney: '',
      changeMoney: 0.00,
      smCode: '',
      printList: [],
      canMod: false,
      orderMessgae: {},
      payTypes: [],
      payTypebs: [],
      mtTgh: '',
      payType: '',
      payTypeb: '',
      changePrice: '',
      cardNum: '',
      showMessage: false,
      cardMessage: {},
      cardPwd: '',
      modPrice: false,
      modPValue: '',
      dialogTableVisible: false,
      remark: '',
      hasLastPrice: false,
      zsmoney: false,
      lastPrice: {},
      authCode: '',
      hyxz: true,
      fyms: '1', // 防疫模式
      type: '',
      code: '',
      integralUse: '0',
      giveMoney: false,
      mealsMemberId: '',
      msCardId: '',
      mealsList: [],
      specialList: [],
      yfdjList: [],
      yfdjId: '',
      showReplacement: false,
      replacement: {},
      tgMemberInfo: {},
      saleType: '',
      typeFlag: '',

    }
  },
  methods: {
    replacementBtn () {
      this.showReplacement = true
      this.tgMemberInfo = {}
    },
    closewReplacement () {
      this.showReplacement = false
    },
    confirmReplacement () {
      this.showReplacement = false
      if (this.tgMemberInfo.id) {
        memberInfo({
          param: {
            id: this.tgMemberInfo.id
          }
        }).then(resb => {
          if (resb.errorCode === '000000') {
            this.replacement = resb.record
            this.yfdjId = ''
            this.getOrderPrice()
          }
        }).catch(err => {
          console.log(err)
        })
        this.tgMemberInfo = {}
      }
    },
    tgMemberSelect (item) {
      const fn = () => {
        this.tgMemberInfo = item
      }
      fn()
    },
    tgMemberClear () {
      this.tgMemberInfo = {}
    },
    smQrbtn () {
      if (this.smCode) {
        this.authCode = this.smCode
        this.showSm = false
      }
    },
    // 订单详情2
    continuePay (id, type, c, e) {
      console.log(id, type, c, '=====0')
      this.typeFlag = e
      this.mtTgh = ''
      this.payMoney = ''
      this.integralUse = '0'
      this.changeMoney = 0.00
      this.cardNum = ''
      this.showMessage = false
      this.cardMessage = {}
      this.cardPwd = ''
      this.modPrice = false
      this.modPValue = ''
      this.remark = ''
      this.authCode = ''
      this.type = type
      this.orderMessgae = {}
      this.lastPrice = {}
      this.hasLastPrice = false
      this.hyxz = true
      this.mealsList = []
      this.yfdjList = []
      this.yfdjId = ''
      this.replacement = {}
      this.tgMemberInfo = {}

      if (type === 'goodsSale') {
        this.code = 'PAY_METHOD_GOODS'
        goodsPayForVenue({
          param: {
            goodsList: id.goodsList,
            memberId: id.memberId,
            remark: id.remark,
            saleType: '0',
            venueId: sessionStorage.getItem('venueId')
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'assemblyField') {
        this.code = 'PAY_JOINT_SITE'
        this.mealsMemberId = ''
        this.mealsList = []
        this.orderMessgae = id
        if (id.memberId) {
          memberInfo({
            param: {
              id: id.memberId
            }
          }).then(res => {
            if (res.errorCode === '000000') {
              this.cardNum = res.record.number
              this.hyxz = false
              this.cardMessage = res.record
              this.showMessage = true
              this.dialogTableVisible = true
              this.$nextTick(() => { this.getDefalutConfig() })
              console.log('userType', this.orderMessgae)
              console.log('', this.type)
            }
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.dialogTableVisible = true
          this.orderMessgae = id
          this.$nextTick(() => { this.getDefalutConfig() })
        }
      } else if (type === 'specialCardBuy') {
        this.code = 'PAY_METHOD_SPECIAL_CARD'
        this.$emit('studentAddSuccess')
        this.orderMessgae = { ...id, allPrice: id.price }
        this.dialogTableVisible = true
        console.log('id', id)
        if (id.memberId) {
          memberInfo({
            param: {
              id: id.memberId
            }
          }).then(resb => {
            if (resb.errorCode === '000000') {
              this.cardNum = resb.record.number
              this.hyxz = false
              this.cardMessage = resb.record
              this.showMessage = true
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.$nextTick(() => { this.getDefalutConfig() })
        }
      } else if (type === 'studentAdd') {
        this.code = 'PAY_METHOD_COURSE'
        this.remark = id.mark || ''
        const param = id
        if (id.memberInfo) {
          this.showMessage = true
          this.hyxz = false
          this.cardMessage = id.memberInfo
        }
        param.venueId = sessionStorage.getItem('venueId')
        enrolCoursePc({
          param,
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.$emit('studentAddSuccess')
              // this.$emit('studentAddSuccess')
              this.orderMessgae = res.record
              if (id.memberInfo && id.sjFlag === '1') {
                this.getMealsReserveCard()
              }
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }, () => {
            this.$emit('openSuccess')
          })
      } else if (type === 'studentPay') {
        this.code = 'PAY_METHOD_COURSE'
        courseGoOnPay({
          param: {
            orderId: id.orderId,
            venueId: sessionStorage.getItem('venueId')
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.$emit('orderSuccess')
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    if (id.courseType === '4') {
                      this.getMealsReserveCard()
                    }
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(() => { })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'goods') {
        this.code = c || 'PAY_METHOD_GOODS'
        goodsOrderContinuePay({
          param: {
            id: id,
            venueId: sessionStorage.getItem('venueId')
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.$emit('orderSuccess')
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(() => { })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'vipRecharge') {
        this.code = 'PAY_METHOD_RECHARGE'
        if (id.memberId) {
          memberInfo({
            param: {
              id: id.memberId
            }
          }).then(res => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.cardNum = res.record.number
              this.hyxz = false
              this.cardMessage = res.record
              this.showMessage = true
              this.orderMessgae = id
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }).catch(err => {
            console.log(err)
          })
        }
      } else if (type === 'groupOpen') {
        this.code = 'PAY_METHOD_MEMBER_TEAM'
        this.dialogTableVisible = true
        this.orderMessgae = id
        if (id.memberId) {
          memberInfo({
            param: {
              id: id.memberId
            }
          }).then(res => {
            if (res.errorCode === '000000') {
              this.cardNum = res.record.number
              this.hyxz = false
              this.cardMessage = res.record
              this.showMessage = true
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.$nextTick(() => { this.getDefalutConfig() })
        }
      } else if (type === 'vipAdd') {
        this.code = 'PAY_METHOD_CARD'
        this.hyxz = false
        this.dialogTableVisible = true
        this.showMessage = true
        this.orderMessgae = {
          ...id,
          orderId: id.id,
          allPrice: id.originalPrice,
          number: c.number
        }
        this.cardMessage = c
        this.cardNum = c.number
        this.$nextTick(() => { this.getDefalutConfig() })
      } else if (type === 'areaSellOrder') {
        this.code = 'PAY_METHOD_SITE'
        this.mealsMemberId = ''
        this.mealsList = []
        if (id.memberId) {
          memberInfo({
            param: {
              id: id.memberId
            }
          }).then(res => {
            if (res.errorCode === '000000') {
              this.cardNum = res.record.number
              this.hyxz = false
              this.cardMessage = res.record
              this.showMessage = true
              this.orderMessgae = id
              this.dialogTableVisible = true
              this.$nextTick(() => { this.getDefalutConfig() })
              if (id.fixedReserve !== '1') {
                this.getMealsReserveCard()
              }
            }
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.dialogTableVisible = true
          this.orderMessgae = id
          this.$nextTick(() => { this.getDefalutConfig() })
        }
      } else if (type === 'comboOrder') {
        this.code = 'PAY_METHOD_MEAL'
        mealPayInfo({
          param: {
            id: id.orderId
          }
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.cardNum = id.memberPhone
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else if (id.memberPhone) {
                VIPInfo({
                  param: {
                    phoneOrNo: id.memberPhone
                  }
                })
                  .then((res) => {
                    if (res.errorCode === '000000') {
                      this.cardMessage = res.record
                      this.hyxz = false
                      this.showMessage = true
                      this.$nextTick(() => { this.getDefalutConfig() })
                    }
                  })
                  .catch(() => { })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'combo') {
        this.code = 'PAY_METHOD_MEAL'
        this.cardNum = id.memberInfo.number
        mealInfo({
          param: {
            mealsList: id.selectedMessage,
            venueId: sessionStorage.getItem('venueId'),
            channelType: '02',
            memberId: id.memberInfo.id,
            remark: id.remark
          },
          userId: sessionStorage.getItem('userId')
        }).then(res => {
          if (res.errorCode === '000000') {
            this.dialogTableVisible = true
            this.orderMessgae = res.record
            this.remark = res.record.remark || ''
            if (res.record.memberId) {
              memberInfo({
                param: {
                  id: res.record.memberId
                }
              }).then(resb => {
                if (resb.errorCode === '000000') {
                  this.cardNum = resb.record.number
                  this.hyxz = false
                  this.cardMessage = resb.record
                  this.showMessage = true
                  this.$nextTick(() => { this.getDefalutConfig() })
                }
              }).catch(err => {
                console.log(err)
              })
            } else {
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }
        }).catch(err => {
          console.log(err)
        })
      } else if (type === 'ticketOrder') {
        this.code = 'PAY_METHOD_TICKET'
        ticketPayAgain({
          param: {
            id,
            venueId: sessionStorage.getItem('venueId')
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'financeDefaultSpend') {
        this.code = 'PAY_METHOD_GENERAL'
        this.dialogTableVisible = true
        this.orderMessgae = id
        this.$nextTick(() => { this.getDefalutConfig() })
      } else if (type === 'handlingFees') {
        this.code = 'PAY_METHOD_SERVICE_CHARGE'
        this.dialogTableVisible = true
        this.orderMessgae = id
        this.$nextTick(() => { this.getDefalutConfig() })
      } else if (type === 'ticket') {
        this.code = 'PAY_METHOD_TICKET'
        payInfo({
          param: {
            tickList: id.p,
            venueId: sessionStorage.getItem('venueId'),
            memberId: id.memberId,
            remark: id.remark
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'defaultReserve') {
        this.code = 'PAY_METHOD_SITE'
        siteOrderInfo({
          param: {
            businessId: id
          },
          userId: sessionStorage.getItem('userId')
        }).then(res => {
          if (res.errorCode === '000000') {
            this.hyxz = false
            this.showMessage = true
            this.orderMessgae = res.record
            this.dialogTableVisible = true
            memberInfo({
              param: {
                id: res.record.memberId
              }
            }).then(resb => {
              if (resb.errorCode === '000000') {
                this.cardNum = resb.record.number
                this.hyxz = false
                this.cardMessage = resb.record
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }).catch(err => {
              console.log(err)
            })
          }
        }).catch(err => {
          console.log(err)
        })
      } else if (type === 'dinner') {
        this.code = 'PAY_METHOD_DIANCAN'
        goodsPayForVenue({
          param: {
            goodsList: id.goodsList,
            // saleType: this.saleType,
            saleType: '1',
            goodsTableId: id.id,
            venueId: sessionStorage.getItem('venueId'),
            memberId: id.memberId || '',
            remark: id.remark || ''
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'dinnerOnline') {
        // 在线点餐
        this.code = 'PAY_METHOD_ONLINE_FOOD'
        goodsPayForVenue({
          param: {
            goodsList: id.goodsList,
            // saleType: this.saleType,
            goodsUserRestaurantId: id.goodsUserRestaurantId,
            saleType: '2',
            goodsTableId: id.id,
            venueId: sessionStorage.getItem('venueId'),
            memberId: id.memberId || '',
            remark: id.remark || ''
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'table') {
        this.code = 'PAY_METHOD_DIANCAN'
        goodsPayForVenue({
          param: {
            goodsList: id,
            saleType: '1',
            goodsTableId: c,
            venueId: sessionStorage.getItem('venueId')
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              this.orderMessgae = res.record
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      } else if (type === 'bracelet') {
        this.code = 'PAY_METHOD_BRACELET'
        this.dialogTableVisible = true
        this.orderMessgae = id
        if (id.memberId) {
          memberInfo({
            param: {
              id: id.memberId
            }
          }).then(res => {
            if (res.errorCode === '000000') {
              this.cardNum = res.record.number
              this.hyxz = false
              this.cardMessage = res.record
              this.showMessage = true
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.$nextTick(() => { this.getDefalutConfig() })
        }
      } else if (type === 'lease') {
        this.code = 'PAY_METHOD_LEASE'
        equipmentLeaseConfirm({
          param: {
            equipmentConfirmParam: id.selectedMessage,
            venueId: sessionStorage.getItem('venueId'),
            leaseUserType: id.memberInfo.leaseUserType,
            memberId: id.memberInfo.id,
            leaseUserPhone: id.memberInfo.phone,
            leaseUserName: id.memberInfo.nickName || '',
            remark: id.remark
          }
        }).then(res => {
          if (res.errorCode === '000000') {
            this.dialogTableVisible = true
            this.orderMessgae = {
              ...res.record,
              allPrice: res.record.price
            }
            this.remark = id.remark || ''
            if (id.memberInfo.id) {
              memberInfo({
                param: {
                  id: id.memberInfo.id
                }
              }).then(resb => {
                if (resb.errorCode === '000000') {
                  this.cardNum = resb.record.number
                  this.hyxz = false
                  this.cardMessage = resb.record
                  this.showMessage = true
                  this.$nextTick(() => { this.getDefalutConfig() })
                }
              }).catch(err => {
                console.log(err)
              })
            } else {
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }
        }).catch(err => {
          console.log(err)
        })
      } else if (type === 'leaseList') {
        this.code = 'PAY_METHOD_LEASE'
        equipmentLeaseContinuePay({
          param: {
            id: id.id
          }
        }).then(res => {
          if (res.errorCode === '000000') {
            this.dialogTableVisible = true
            this.orderMessgae = {
              ...res.record,
              allPrice: res.record.price
            }
            this.remark = id.remark || ''
            if (res.record.memberId) {
              memberInfo({
                param: {
                  id: res.record.memberId
                }
              }).then(resb => {
                if (resb.errorCode === '000000') {
                  this.cardNum = resb.record.number
                  this.hyxz = false
                  this.cardMessage = resb.record
                  this.showMessage = true
                  this.$nextTick(() => { this.getDefalutConfig() })
                }
              }).catch(err => {
                console.log(err)
              })
            } else {
              this.$nextTick(() => { this.getDefalutConfig() })
            }
          }
        }).catch(err => {
          console.log(err)
        })
      } else if (type === 'escort') {
        this.code = 'PAY_METHOD_ESCORT'
        escortPayInfo({
          param: {
            orderId: id,
            venueId: sessionStorage.getItem('venueId')
          },
          userId: sessionStorage.getItem('userId')
        })
          .then((res) => {
            if (res.errorCode === '000000') {
              this.dialogTableVisible = true
              const su = res.record
              su.orderId = id
              su.allPrice = su.price
              this.orderMessgae = su
              this.remark = res.record.remark || ''
              if (res.record.memberId) {
                memberInfo({
                  param: {
                    id: res.record.memberId
                  }
                }).then(resb => {
                  if (resb.errorCode === '000000') {
                    this.$emit('orderSuccess')
                    this.cardNum = resb.record.number
                    this.hyxz = false
                    this.cardMessage = resb.record
                    this.showMessage = true
                    this.$nextTick(() => { this.getDefalutConfig() })
                  }
                }).catch(() => { })
              } else {
                this.$nextTick(() => { this.getDefalutConfig() })
              }
            }
          })
      }
    },
    mtZf (code) {
      this.mtTgh = code
    },
    getMealsReserveCard () {
      mealsReserveCard({
        param: {
          memberId: this.orderMessgae.memberId || this.cardMessage.id,
          orderId: this.orderMessgae.orderId
        }
      }).then(res => {
        if (res.errorCode === '000000') {
          this.mealsList = res.record || []
          this.mealsList.forEach(item => {
            if (item.type === '1' || item.type === '4') {
              item.label = item.name + ' ' + this.$t('message.yxqz') + item.validityEndTime
            } else {
              item.label = item.name + ' ' + this.$t('message.sy') + '：' + item.remainNumCount + this.$t('message.ci') + ' ' + this.$t('message.yxqz') + item.validityEndTime
            }
          })
        }
      }).catch(err => {
        console.log(err)
      })
    },
    getSpecialCard () {
      ableOrienteerByOrder({
        param: {
          memberId: this.orderMessgae.memberId || this.cardMessage.id,
          orderId: this.orderMessgae.orderId
        }
      }).then(res => {
        if (res.errorCode === '000000') {
          this.specialList = res.recordList.map(item => {
            item.name = item.name + ' ' + this.$t('message.ye') + '：' + item.amount
            return item
          })
          if (this.specialList.length > 0) {
            this.$set(this, 'msCardId', this.specialList[0].id)
            // this.msCardId = this.specialList[0].id
            this.getOrderPrice()
          }
        }
      }).catch(err => {
        console.log(err)
      })
    },
    payByMoney () {
      if (!this.payMoney) {
        this.changeMoney = 0.00
        return
      }
      if (this.payMoney.length === 1 && [1, 2, 3, 4, 5, 6, 7, 8, 9].indexOf(Number(this.payMoney)) === -1) {
        this.payMoney = ''
        return
      }
      if (this.modPValue) {
        if (parseFloat(this.payMoney) < parseFloat(this.modPValue)) {
          // this.$message.error('实付现金不能小于应付金额')
          this.changeMoney = 0.00
          return
        }
      } else {
        if (parseFloat(this.payMoney) < parseFloat(this.orderMessgae.allPrice)) {
          // this.$message.error('实付现金不能小于应付金额')
          this.changeMoney = 0.00
          return
        }
      }
      this.changeMoney = parseFloat(this.payMoney) - (this.modPrice ? parseFloat(this.modPValue) : parseFloat(this.orderMessgae.allPrice))
    },
    payByMoneyb () {
      if (!this.payMoney) {
        this.changeMoney = 0.00
        return
      }
      if (this.payMoney.length === 1 && [1, 2, 3, 4, 5, 6, 7, 8, 9].indexOf(Number(this.payMoney)) === -1) {
        this.payMoney = ''
        return
      }
      const cardPayPrice = this.cardPayPrice
      let yfMoney = 0
      if (this.modPValue) {
        yfMoney = parseFloat(this.payMoney) - (parseFloat(this.modPValue) - parseFloat(cardPayPrice))
        if (yfMoney <= 0) {
          // this.$message.error('实付现金不能小于应付金额')
          this.changeMoney = 0.00
          return
        }
      } else {
        yfMoney = parseFloat(this.payMoney) - (parseFloat(this.lastPrice.price) - parseFloat(cardPayPrice))
        if (yfMoney <= 0) {
          // this.$message.error('实付现金不能小于应付金额')
          this.changeMoney = 0.00
          return
        }
      }
      this.changeMoney = yfMoney
    },
    searchAction () {
      if (!this.cardNum.length) {
        this.$message.error(this.$t('message.qsr' + this.$t('message.hy1')))
        return
      }
      VIPInfo({
        param: {
          phoneOrNo: this.cardNum
        }
      })
        .then((res) => {
          if (res.errorCode === '000000') {
            this.cardMessage = res.record
            // this.getMealsReserveCard()
            this.showMessage = true
            this.getOrderPrice()
          }
        })
        .catch(() => { })
    },
    changePayType (item) {
      if (this.payType === item.value) {
        return
      }
      this.integralUse = '0'
      this.payType = item.value
      if (item.value === '13') {
        this.getSpecialCard()
        return
      }
      if (item.value === '04' || item.value === '05' || item.value === '08') {
        this.showSm = true
        this.smCode = ''
        this.$nextTick(() => {
          this.$refs.code.focus()
        })
      }
      this.getOrderPrice()
    },
    changePayTypeb (item) {
      // if (this.payTypeb === item.value) {
      //   return
      // }
      this.integralUse = '0'
      // this.payTypeb = item.value
      if (this.payTypeb === '04' || this.payTypeb === '05' || this.payTypeb === '08') {
        this.showSm = true
        this.smCode = ''
        this.$nextTick(() => {
          this.$refs.code.focus()
        })
      }
    },
    payOrder () {
      console.log(this.payType, 'paytype0000')
      // 支付订单
      const param = {}
      param.policyId = this.lastPrice.policy
      param.msCardId = this.msCardId || null

      if (this.remark) {
        param.note = this.remark
      }
      param.change = '0'
      if (this.modPrice) {
        param.change = '1'
        param.changePrice = this.modPValue
        if (!this.modPValue && this.modPValue !== '0' && this.modPValue !== 0) {
          return this.$message.error(this.$t('message.qsr') + this.$t('message.zfje'))
        }
        param.integralUse = '0'
      } else {
        param.change = '0'
        param.changePrice = ''
      }
      if (this.payType === '01' || this.payType === '13') {
        param.integralUse = this.integralUse
      } else {
        param.integralUse = '0'
      }
      param.orderId = this.orderMessgae.orderId
      param.payMethod = this.payType
      if (this.payType === '14') {
        param.mixedPay = this.payTypeb
        param.cardPayPrice = (Number(this.cardMessage.remainingMoney) + Number(this.cardMessage.remainingGiveMoney)).toFixed(2)
      }
      param.policyId = this.lastPrice.policyId
      if (this.payType === '13') {
        param.giveMoney = this.giveMoney
      }
      if (this.payType === '01' || this.payType === '14') {
        if (!this.cardMessage.id) {
          this.$message.error(this.$t('message.qxsearchhy'))
          return
        }
        param.memberId = this.cardMessage.id
        if (this.lastPrice.isRequired === '1') {
          if (!this.cardPwd) {
            this.$message.error(this.$t('message.qsr') + this.$t('message.zfmm'))
            return
          } else if (this.cardPwd.length !== 6) {
            this.$message.error(this.$t('message.qsrlwzfmm'))
            return
          }
        }

        param.payPwd = this.cardPwd
        param.giveMoney = this.giveMoney
      }
      if (this.fyms === '0') {
        if (!this.cardMessage.id) {
          this.$message.error(this.$t('message.dqmyms'))
          return
        }
        param.memberId = this.cardMessage.id
      }
      if (this.payType === '10' || (this.payType === '14' && this.payTypeb === '10')) {
        if (!this.mtTgh) {
          this.$message.error(this.$t('message.qsr') + this.$t('message.mttgh'))
          return
        }
        param.couponCode = this.mtTgh
      }
      param.mealsMemberId = this.mealsMemberId
      param.consumeGeneralId = this.yfdjId
      if ((this.payType === '01' || this.payType === '02' || this.payType === '07' || this.payType === '10' || this.payType === '13') || ((this.payTypeb === '01' || this.payTypeb === '02' || this.payTypeb === '07' || this.payTypeb === '10' || this.payTypeb === '13') && this.payType === '14')) {
        this.payLoading = true
        payForOrder({
          param: param
        })
          .then((res) => {
            this.payLoading = false
            if (res.errorCode === '000000') {
              this.$message.success(this.$t('message.zfcg'))
              console.log('jinlail====================', this.type)
              this.print()
            }
          })
          .catch(() => {
            this.payLoading = false
          })
      } else {
        if (this.lastPrice.allPrice <= 0 || (this.modPrice && this.modPValue.length && this.modPValue <= 0)) {
          this.payLoading = true
          payForOrder({
            param: param
          })
            .then((res) => {
              this.payLoading = false
              if (res.errorCode === '000000') {
                this.print()
              }
            })
            .catch(() => {
              this.payLoading = false
            })
        } else {
          if (!this.authCode.length) {
            this.$message.error(this.$t('message.qsrsm'))
            return
          }
          if (this.fyms === '0') {
            if (!this.cardMessage.id) {
              this.$message.error(this.$t('message.dqmyms'))
              return
            }
          }
          var totalAmount = this.lastPrice.price
          if (this.modPrice) {
            totalAmount = this.modPValue
          }
          var type = this.payType === '04' ? '1' : this.payType === '05' ? '0' : this.payType === '14' ? '4' : '2'
          var status = this.modPrice ? '1' : '0'
          const paramb = {
            policyId: this.lastPrice.policyId,
            memberId: this.cardMessage.id || '',
            type: type,
            status: status,
            authCode: this.authCode,
            outTradeNo: this.orderMessgae.orderId,
            subject: this.$t('message.sp'),
            totalAmount: totalAmount
          }
          if (this.payType === '14') {
            paramb.mixedPay = this.payTypeb
            paramb.cardPayPrice = (Number(this.cardMessage.remainingMoney) + Number(this.cardMessage.remainingGiveMoney)).toFixed(2)
          }
          paramb.consumeGeneralId = this.yfdjId
          scanCodePay({
            param: paramb
          })
            .then((res) => {
              if (res.errorCode === '000000') {
                const str = res.record.msg
                if (res.record.code === '0') {
                  this.$message.success(str)
                  this.print()
                } else if (res.record.code === '2') {
                  this.showLoding(5000, str)
                  setTimeout(() => {
                    orderType({
                      param: {
                        orderId: this.orderMessgae.orderId
                      }
                    })
                      .then((resb) => {
                        const strb = resb.record.msg
                        if (resb.errorCode === '000000') {
                          if (resb.record.code === '0') {
                            this.$message.success(strb)
                            this.print()
                          } else if (resb.record.code === '2') {
                            this.$message.info(strb)
                          } else {
                            this.$message.error(strb)
                          }
                        }
                      })
                      .catch(() => { })
                  }, 5000)
                } else {
                  this.$message.error(str)
                }
              }
            })
            .catch(() => { })
        }
      }
    },
    print () {
      console.log('打印方法开始')
      let templateCode = ''
      // || this.type === 'dinner' || this.type === 'table' || this.type === 'goodsSale'|| this.type === 'goods'
      if (this.type === 'studentAdd' || this.type === 'dinner' || this.type === 'dinnerOnline' || this.typeFlag == 'zxdc' || this.type === 'table') {
        this.$emit('orderSuccess')
        this.dialogTableVisible = false
        return false
      }
      switch (this.type) {
        case 'specialCardBuy':
          templateCode = 'SPECIAL_CARD_ORDER'
          break
        case 'studentPay':
          templateCode = 'COURSETPML'
          break
        case 'handlingFees':
          templateCode = 'SERVICE_CHARGE_ORDER'
          break
        case 'assemblyField':
          templateCode = 'SITETPML'
          break
        case 'goodsSale':
        case 'goods':
          templateCode = 'GOODSTPML'
          break
        case 'areaSellOrder':
        case 'defaultReserve':
          templateCode = 'SITETPML'
          break
        case 'comboOrder':
        case 'combo':
          templateCode = 'MEALSTPML'
          break
        case 'ticket':
        case 'ticketOrder':
          templateCode = 'TICKETTPML'
          break
        case 'financeDefaultSpend':
          templateCode = 'CONSUMETPML'
          break
        case 'dinner':
        case 'dinnerOnline':
        case 'table':
          templateCode = 'GOODSTPML2'
          break
        case 'vipRecharge':
          templateCode = 'MECHARGETPML'
          break
        case 'vipAdd':
          templateCode = 'MECARDTPML'
          break
        case 'bracelet':
          templateCode = 'BRACELET_TPML'
          break
        case 'groupOpen':
          templateCode = 'MECHARGETPML'
          break
        case 'lease':
        case 'leaseList':
          templateCode = 'LEAST_TMPL'
          break
        case 'escort':
          templateCode = 'ESCORT_ORDER'
          break
        default:
          break
      }
      if (this.type === 'ticket' || this.type === 'ticketOrder' || this.type === 'areaSellOrder') {
        this.isPrint1 = true
      }
      if (this.type === 'combo' || this.type === 'comboOrder') {
        this.isPrint2 = true
      }
      if (this.type === 'course' || this.type === 'courseOrder' || this.type === 'studentPay') {
        this.isPrint3 = true
      }
      if (this.type === 'goods' || this.type === 'goodsSale' || this.type === 'financeDefaultSpend') {
        this.isPrint6 = true
      }
      if (this.type === 'vipRecharge' || this.type === 'vipAdd' || this.type === 'bracelet' || this.type === 'specialCardBuy' || this.type === 'handlingFees') {
        this.isPrint4 = true
      }
      if (this.type === 'escort') {
        this.isPrint5 = true
      }
      if (this.type === 'lease' || this.type === 'leaseList') {
        this.isPrint4 = true
      }
      printOrder({
        param: {
          contentMap: {},
          venueId: sessionStorage.getItem('venueId'),
          workId: this.orderMessgae.orderId,
          templateCode
        }
      })
        .then((res) => {
          if (res.errorCode === '000000') {
            if (res.record && res.record.isPrint === '1' && res.record.dataList && res.record.dataList.length > 0) {
              this.printList = res.record.dataList
              if (res.record.dataList.length === 1) {
                if (this.type === 'handlingFees') {
                  this.$refs.RechargeTemRef.obj = { ...res.record.dataList[0] }
                  this.$refs.RechargeTemRef.desc = this.$t('message.rechargeTemPlace')
                  setTimeout(() => {
                    this.$refs.RechargeTemRef.print()
                  }, 300)
                }
                if (this.type === 'bracelet') {
                  this.$refs.RechargeTemRef.obj = { ...res.record.dataList[0] }
                  this.$refs.RechargeTemRef.desc = this.$t('message.shTemPlace')
                  setTimeout(() => {
                    this.$refs.RechargeTemRef.print()
                  }, 300)
                }
                if (this.type === 'specialCardBuy') {
                  this.$refs.RechargeTemRef.obj = { ...res.record.dataList[0] }
                  this.$refs.RechargeTemRef.desc = this.$t('message.dytsy1')
                  setTimeout(() => {
                    this.$refs.RechargeTemRef.print()
                  }, 300)
                }
                if (this.type === 'ticket' || this.type === 'ticketOrder' || this.type === 'areaSellOrder') {
                  this.$refs.printTemRef.obj = { ...res.record.dataList[0] }
                  setTimeout(() => {
                    this.$refs.printTemRef.print()
                  }, 300)
                }
                // 套餐
                if (this.type === 'combo' || this.type === 'comboOrder') {
                  this.$refs.ComboTemRef.obj = { ...res.record.dataList[0] }
                  setTimeout(() => {
                    this.$refs.ComboTemRef.print()
                  }, 300)
                }
                // 课程
                if (this.type === 'course' || this.type === 'courseOrder' || this.type === 'studentPay') {
                  this.$refs.CourseTemRef.obj = { ...res.record.dataList[0] }
                  setTimeout(() => {
                    this.$refs.CourseTemRef.print()
                  }, 300)
                }
                // 伴有卡
                if (this.type === 'escort') {
                  this.$refs.BykTemRef.obj = { ...res.record.dataList[0] }
                  setTimeout(() => {
                    this.$refs.BykTemRef.print()
                  }, 300)
                }
                // 商品
                if (this.type === 'goods' || this.type === 'goodsSale' || this.type === 'financeDefaultSpend') {
                  this.$refs.GoodsTemRef.obj = { ...res.record.dataList[0] }
                  setTimeout(() => {
                    this.$refs.GoodsTemRef.print()
                  }, 300)
                }
                // 会员
                if (this.type === 'vipRecharge' || this.type === 'vipAdd') {
                  this.$refs.RechargeTemRef.obj = { ...res.record.dataList[0] }
                  this.$refs.RechargeTemRef.desc = this.$t('message.rechargeTemPlace')
                  setTimeout(() => {
                    this.$refs.RechargeTemRef.print()
                  }, 300)
                }
                if (this.type === 'lease' || this.type === 'leaseList') {
                  this.$refs.RechargeTemRef.obj = { ...res.record.dataList[0], ddstatus: '0' }
                  this.$refs.RechargeTemRef.desc = this.$t('message.ZLTemPlace')
                  setTimeout(() => {
                    this.$refs.RechargeTemRef.print()
                  }, 300)
                }
                setTimeout(() => {
                  this.isPrint1 = false
                  this.isPrint2 = false
                  this.isPrint3 = false
                  this.isPrint4 = false
                  this.isPrint5 = false
                  this.isPrint6 = false
                  this.isPrint7 = false
                  this.$emit('orderSuccess')
                  this.dialogTableVisible = false
                }, 1200)
              } else {
                this.isPrint1 = false
                this.isPrint2 = false
                this.isPrint3 = false
                this.isPrint4 = false
                this.isPrint5 = false
                this.isPrint6 = false
                this.isPrint7 = false
                this.$refs.PrintTableRef.showDetail(res.record)
              }
            } else {
              this.isPrint1 = false
              this.isPrint2 = false
              this.isPrint3 = false
              this.isPrint4 = false
              this.isPrint5 = false
              this.isPrint6 = false
              this.isPrint7 = false
              this.$emit('orderSuccess')
              this.dialogTableVisible = false
            }
          } else {
            this.isPrint1 = false
            this.isPrint2 = false
            this.isPrint3 = false
            this.isPrint4 = false
            this.isPrint5 = false
            this.isPrint6 = false
            this.isPrint7 = false
            this.$emit('orderSuccess')
            this.dialogTableVisible = false
          }
        })
        .catch(() => {
          this.isPrint1 = false
          this.isPrint2 = false
          this.isPrint3 = false
          this.isPrint4 = false
          this.isPrint5 = false
          this.isPrint6 = false
          this.$emit('orderSuccess')
          this.dialogTableVisible = false
        })
    },
    cancelDialog () {
      this.isPrint1 = false
      this.isPrint2 = false
      this.isPrint3 = false
      this.isPrint4 = false
      this.isPrint5 = false
      this.isPrint6 = false
      this.isPrint7 = false
      this.dialogTableVisible = false
      this.$emit('orderSuccess')
    },
    printd (index) {
      if (this.type === 'ticket' || this.type === 'ticketOrder' || this.type === 'areaSellOrder') {
        this.isPrint1 = true
      }
      if (this.type === 'combo' || this.type === 'comboOrder') {
        this.isPrint2 = true
      }
      if (this.type === 'course' || this.type === 'courseOrder' || this.type === 'studentPay') {
        this.isPrint3 = true
      }
      if (this.type === 'goods' || this.type === 'goodsSale' || this.type === 'financeDefaultSpend') {
        this.isPrint6 = true
      }
      if (this.type === 'vipRecharge' || this.type === 'vipAdd' || this.type === 'bracelet' || this.type === 'specialCardBuy' || this.type === 'handlingFees') {
        this.isPrint4 = true
      }
      if (this.type === 'escort') {
        this.isPrint5 = true
      }
      if (this.type === 'lease' || this.type === 'leaseList') {
        this.isPrint4 = true
      }
      const arr = [...this.printList]
      setTimeout(() => {
        if (this.type === 'bracelet') {
          this.$refs.RechargeTemRef.obj = { ...arr[index] }
          this.$refs.RechargeTemRef.desc = this.$t('message.shTemPlace')
          setTimeout(() => {
            this.$refs.RechargeTemRef.print()
          }, 500)
        }
        if (this.type === 'specialCardBuy') {
          this.$refs.RechargeTemRef.obj = { ...arr[index] }
          this.$refs.RechargeTemRef.desc = this.$t('message.dytsy1')
          setTimeout(() => {
            this.$refs.RechargeTemRef.print()
          }, 500)
        }
        if (this.type === 'ticket' || this.type === 'ticketOrder' || this.type === 'areaSellOrder') {
          this.$refs.printTemRef.obj = { ...arr[index] }
          setTimeout(() => {
            this.$refs.printTemRef.print()
          }, 500)
        }
        // 套餐
        if (this.type === 'combo' || this.type === 'comboOrder') {
          this.$refs.ComboTemRef.obj = { ...arr[index] }
          setTimeout(() => {
            this.$refs.ComboTemRef.print()
          }, 500)
        }
        // 课程
        if (this.type === 'course' || this.type === 'courseOrder' || this.type === 'studentPay') {
          this.$refs.CourseTemRef.obj = { ...arr[index] }
          setTimeout(() => {
            this.$refs.CourseTemRef.print()
          }, 500)
        }
        // 伴有卡
        if (this.type === 'escort') {
          this.$refs.BykTemRef.obj = { ...arr[index] }
          setTimeout(() => {
            this.$refs.BykTemRef.print()
          }, 500)
        }
        // 商品
        if (this.type === 'goods' || this.type === 'goodsSale' || this.type === 'financeDefaultSpend') {
          this.$refs.GoodsTemRef.obj = { ...arr[index] }
          setTimeout(() => {
            this.$refs.GoodsTemRef.print()
          }, 500)
        }
        // 会员
        if (this.type === 'vipRecharge' || this.type === 'vipAdd') {
          this.$refs.RechargeTemRef.obj = { ...arr[index] }
          this.$refs.RechargeTemRef.desc = this.$t('message.rechargeTemPlace')
          setTimeout(() => {
            this.$refs.RechargeTemRef.print()
          }, 500)
        }
        if (this.type === 'lease' || this.type === 'leaseList') {
          this.$refs.RechargeTemRef.obj = { ...arr[index], ddstatus: '0' }
          this.$refs.RechargeTemRef.desc = this.$t('message.ZLTemPlace')
          setTimeout(() => {
            this.$refs.RechargeTemRef.print()
          }, 500)
        }
      }, 300)
      setTimeout(() => {
        this.isPrint1 = false
        this.isPrint2 = false
        this.isPrint3 = false
        this.isPrint4 = false
        this.isPrint5 = false
        this.isPrint6 = false
        this.isPrint7 = false
      }, 1000)
    },
    showLoding (time, title) {
      const loading = this.$loading({
        lock: true,
        text: title,
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.5)'
      })
      setTimeout(() => {
        loading.close()
      }, time)
    },
    cancelOrder () {
      // 取消支付
      this.$emit('cancelOrder')
      this.dialogTableVisible = false
      if (this.type === 'dinner' || this.type === 'ticket' || this.type === 'dinnerOnline') {
        // this.$emit('orderSuccess')
        this.$emit('cancelOrder')
      }
    },
    getDefalutConfig () {
      // configList({ param: { type: '7', code: 'EPIDEMIC_PREVENTION_MODE' }})
      //   .then((res) => {
      //     if (res.errorCode !== '000000') return
      //     const valueList = res.recordList
      //     const obj = valueList.find(item => item.code === 'EPIDEMIC_PREVENTION_MODE')
      //     this.fyms = obj.name
      //   })
      //   .catch((err) => {
      //     console.log(err)
      //   })
      this.$emit('openSuccess')
      configList({ param: { type: '6' } })
        .then((res) => {
          if (res.errorCode !== '000000') return
          const valueListb = res.recordList
          const obj = valueListb.find(item => item.code === 'EDIT_PRICE_CONFIG')
          if (obj && obj.name) {
            this.canMod = true
          }
        })
        .catch((err) => {
          console.log(err)
        })
      configList({ param: { type: '2', code: this.code } })
        .then((res) => {
          if (res.errorCode !== '000000') return
          const arr = res.recordList || []
          const payTypes = []
          const payTypebs = []
          if (res.recordList && res.recordList.length > 0) {
            let payType = res.recordList[0].value
            arr.forEach((e) => {
              if (e.value !== '01' && e.value !== '14' && e.value !== '13') {
                payTypebs.push(e)
              }
              if (e.value === '14') {
                e.show = false
                payTypes.push(e)
              } else {
                e.show = true
                payTypes.push(e)
              }
              if (e.value === '01') {
                if (this.cardMessage.id) {
                  payType = e.value
                } else if (payType === '01') {
                  payType = res.recordList[1].value
                }
              }
            })
            this.payTypes = payTypes
            this.payType = payType
            this.payTypebs = payTypebs
            this.getOrderPrice()
          }
        })
        .catch(() => { })
    },
    getOrderPrice (type) {
      if (this.modPrice) {
        return
      }
      this.lastPrice = {}
      this.hasLastPrice = false
      const param = {}
      param.orderId = this.orderMessgae.orderId
      param.payMethod = this.payType
      param.mealsMemberId = this.mealsMemberId
      param.msCardId = this.msCardId || null
      param.consumeGeneralId = this.yfdjId || null
      if (this.payType === '01') {
        if (this.cardMessage.id) {
          param.memberId = this.cardMessage.id
        } else {
          this.$message.warning(this.$t('message.qxsearchhy'))
          return
        }
      }
      if (this.cardMessage.id && type !== 1) {
        this.getDjList()
      }
      getPrice(
        {
          param: param
        }
      ).then(res => {
        if (res.errorCode === '000000') {
          this.lastPrice = res.record
          this.hasLastPrice = true
          const payTypes = [...this.payTypes]
          const payTypebs = [...this.payTypebs]
          let yfMoney = 0
          if (this.modPrice) {
            yfMoney = this.modPValue || 0
          } else {
            yfMoney = res.record.price
          }
          yfMoney = Number(yfMoney)
          if (this.cardMessage.id) {
            this.cardPayPrice = (Number(this.cardMessage.remainingMoney) + Number(this.cardMessage.remainingGiveMoney)).toFixed(2)
            const money = Number(this.cardMessage.remainingMoney) + Number(this.cardMessage.remainingGiveMoney)
            if (money > 0 && money < yfMoney) {
              payTypes.forEach((s, i) => {
                if (s.value === '14') {
                  s.show = true
                  if (payTypebs[0] === '14') {
                    this.payTypeb = payTypebs[1].value
                  } else {
                    this.payTypeb = payTypebs[0].value
                  }
                }
              })
            }
          }
          this.payTypes = payTypes
          this.payByMoneyb()
          this.payByMoney()
        }
      }).catch(() => { })
    },
    getDjList () {
      getOneByOrderAndMember(
        {
          param: {
            memberId: this.replacement.id ? this.replacement.id : this.cardMessage.id,
            orderId: this.orderMessgae.orderId
          }
        }
      ).then(res => {
        if (res.errorCode === '000000') {
          this.yfdjList = res.recordList
          // if (res.recordList && res.recordList.length > 0) {
          //  this.yfdjId = res.recordList[0].id
          //  this.getOrderPrice(1)
          // }
        }
      }).catch(() => { })
    },
    gjChange () {
      if (this.cardMessage.id) {
        const payTypes = [...this.payTypes]
        let yfMoney = 0
        if (this.modPrice) {
          yfMoney = this.modPValue || 0
        } else {
          yfMoney = this.lastPrice.price
        }
        this.cardPayPrice = (Number(this.cardMessage.remainingMoney) + Number(this.cardMessage.remainingGiveMoney)).toFixed(2)
        const money = Number(this.cardMessage.remainingMoney) + Number(this.cardMessage.remainingGiveMoney)
        if (money > 0 && money < yfMoney) {
          payTypes.forEach((s, i) => {
            if (s.value === '14') {
              s.show = true
            }
          })
        } else {
          payTypes.forEach((s, i) => {
            if (s.value === '14') {
              s.show = false
            }
            if (this.payType === '14') {
              if (payTypes[0].value === '14') {
                this.payType === payTypes[1].value
              } else {
                this.payType = payTypes[0].value
              }
            }
          })
        }
        this.payTypes = payTypes
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@import "@/styles/variables.scss";

.orderBox {
  min-height: 400px;
  display: flex;

  .orderLeft {
    width: 450px;
    margin-right: 20px;
    margin-bottom: 20px;
    flex: none;

    .orderPriceBt {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #222222;
      line-height: 1;
      margin-bottom: 20px;
    }

    .gjCnt {
      font-size: 14px;
      margin-bottom: 20px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #222222;
      line-height: 14px;

      .el-input {
        width: 100px;
        margin: 0 5px;
      }
    }
  }

  .orderRight {
    flex: 1;

    .pay-style {
      text-align: center;
      height: 36px;
      box-sizing: border-box;
      padding: 0 10px;
      font-size: 14px;
      line-height: 36px;
      vertical-align: middle;
      margin: 0 10px 10px 0;

      &.slelect-pay-style {
        background-color: $primaryColor;
        color: #fff;
      }

      &.normal-pay-style {
        background: #f7f7f7;
        color: #333333;
      }
    }

    .memberDetail {
      flex: 1;
      background: #f4f7fc;
      border-radius: 4px;
      width: 100%;
      padding: 10px 15px;
      display: flex;
      align-items: center;
      margin-bottom: 20px;

      img {
        width: 40px;
        height: 40px;
        border-radius: 20px;
        margin-right: 10px;
      }

      .memberRight {
        flex: 1;
        display: flex;
        flex-wrap: wrap;
        font-size: 13px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #666666;
        line-height: 1.5;

        div {
          width: 50%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;

          &:first-of-type {
            width: 100%;
            font-size: 14px;
            font-family: PingFangSC-Semibold, PingFang SC;
            font-weight: 600;
            color: #333333;
          }

          span {
            color: #222222;

            &.money {
              color: $SecondColor;
            }
          }
        }
      }
    }

    .zffsBt {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #222222;
      line-height: 16px;
      margin-bottom: 16px;
    }

    .yhzc {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #222222;
      line-height: 1.5;
      margin: 10px 0;

      span {
        color: $primaryColor;
      }
    }
  }
}

.footCnt {
  border-top: 1px solid #dfe2e8;
  width: 1000px;
  margin-left: -30px;
  margin-bottom: -20px;
  box-sizing: border-box;
  padding: 10px 30px;
  line-height: 36px;
  display: flex;
  justify-content: flex-end;
  position: relative;

  .bottom-left {
    position: absolute;
    left: 30px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #222222;

    span {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: $SecondColor;

      &.ys {
        font-size: 16px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #222222;
      }

      &.ysje {
        font-size: 16px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        margin-right: 20px;
      }
    }
  }

  .bottom-right {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #222222;

    b {
      color: #333333;
      margin-left: 4px;
    }
  }
}
.smtip {
  font-size: 16px;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 500;
  color: #333333;
  line-height: 16px;
  margin-top: 30px;
  text-align: center;
}
.smImg {
  display: block;
  margin: 20px auto 45px;
  width: 200px;
  height: 200px;
}
.smFoot {
  display: flex;
}
</style>
